<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<html>

<head>
    <script src="js/jquery/2.0.0/jquery.min.js"></script>
    <link href="css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
    <script src="js/bootstrap/3.3.6/bootstrap.min.js"></script>
    <link href="css/index.css" rel="stylesheet">
</head>

<body>
<%@include file="nav.jsp"%>
<%@include file="header.jsp"%>

<%@include file="categorybar.jsp"%>
<div>
    <div class="productPageDiv">

        <script>

            $(function(){
                var stock = 66;
                $(".productNumberSetting").keyup(function(){
                    var num= $(".productNumberSetting").val();
                    num = parseInt(num);
                    if(isNaN(num))
                        num= 1;
                    if(num<=0)
                        num = 1;
                    if(num>stock)
                        num = stock;
                    $(".productNumberSetting").val(num);
                });

                $(".increaseNumber").click(function(){
                    var num= $(".productNumberSetting").val();
                    num++;
                    if(num>stock)
                        num = stock;
                    $(".productNumberSetting").val(num);
                });
                $(".decreaseNumber").click(function(){
                    var num= $(".productNumberSetting").val();
                    --num;
                    if(num<=0)
                        num=1;
                    $(".productNumberSetting").val(num);
                });

                $(".addCartLink").click(function(){
                    var page = "forecheckLogin";
                    if(false)$.get(
                        page,
                        function(result){
                            if("success"==result){
                                var pid = 819;
                                var num= $(".productNumberSetting").val();
                                var addCartpage = "foreaddCart";
                                if(false)$.get(
                                    addCartpage,
                                    {"pid":pid,"num":num},
                                    function(result){
                                        if("success"==result){
                                            $(".addCartButton").html("已加入购物车");
                                            $(".addCartButton").attr("disabled","disabled");
                                            $(".addCartButton").css("background-color","lightgray")
                                            $(".addCartButton").css("border-color","lightgray")
                                            $(".addCartButton").css("color","black")

                                        }
                                        else{

                                        }
                                    }
                                );
                            }
                            else{
                                $("#loginModal").modal('hide');
                            }
                        }
                    );
                    return false;
                });
                $(".buyLink").click(function(){
                    var page = "forecheckLogin";
                    if(false)$.get(
                        page,
                        function(result){
                            if("success"==result){
                                var num = $(".productNumberSetting").val();
                                location.href= $(".buyLink").attr("href")+"&num="+num;
                            }
                            else{
                                $("#loginModal").modal('hide');
                            }
                        }
                    );
                    return false;
                });

                $("button.loginSubmitButton").click(function(){
                    var name = $("#name").val();
                    var password = $("#password").val();

                    if(0==name.length||0==password.length){
                        $("span.errorMessage").html("请输入账号密码");
                        $("div.loginErrorMessageDiv").show();
                        return false;
                    }

                    var page = "foreloginAjax";
                    if(false)$.get(
                        page,
                        {"name":name,"password":password},
                        function(result){
                            if("success"==result){
                                location.reload();
                            }
                            else{
                                $("span.errorMessage").html("账号密码错误");
                                $("div.loginErrorMessageDiv").show();
                            }
                        }
                    );

                    return true;
                });

                $("img.smallImage").mouseenter(function(){
                    var bigImageURL = $(this).attr("bigImageURL");
                    $("img.bigImg").attr("src",bigImageURL);
                });

                $("img.bigImg").load(
                    function(){
                        $("img.smallImage").each(function(){
                            var bigImageURL = $(this).attr("bigImageURL");
                            img = new Image();
                            img.src = bigImageURL;

                            img.onload = function(){
                                console.log(bigImageURL);
                                $("div.img4load").append($(img));
                            };
                        });
                    }
                );
            });

        </script>

        <div class="imgAndInfo">

            <div class="imgInimgAndInfo">
                <img src="${p.pic}" class="bigImg">
                <div class="smallImageDiv">

                    <img src="img/productSingle_small/8620.jpg" bigImageURL="img/productSingle/8620.jpg" class="smallImage">

                    <img src="img/productSingle_small/8619.jpg" bigImageURL="img/productSingle/8619.jpg" class="smallImage">

                    <img src="img/productSingle_small/8618.jpg" bigImageURL="img/productSingle/8618.jpg" class="smallImage">

                    <img src="img/productSingle_small/8617.jpg" bigImageURL="img/productSingle/8617.jpg" class="smallImage">

                    <img src="img/productSingle_small/8616.jpg" bigImageURL="img/productSingle/8616.jpg" class="smallImage">

                </div>
                <div class="img4load hidden" ></div>
            </div>

            <div class="infoInimgAndInfo">

                <div class="productTitle">
                    ${p.name}
                </div>
                <div class="productSubTitle">
                    高端定制 高档棉麻 现货即发 加购物车 领优惠卷
                </div>

                <div class="productPrice">
                    <div class="juhuasuan">
                        <span class="juhuasuanBig" >聚划算</span>
                        <span>此商品即将参加聚划算，<span class="juhuasuanTime">1天19小时</span>后开始，</span>
                    </div>
                    <div class="productPriceDiv">
                        <div class="gouwujuanDiv"><img height="16px" src="img/site/gouwujuan.png">
                            <span> 全天猫实物商品通用</span>

                        </div>
                        <div class="originalDiv">
                            <span class="originalPriceDesc">价格</span>
                            <span class="originalPriceYuan">¥</span>
                            <span class="originalPrice">

						${p.marketPrice}
					</span>
                        </div>
                        <div class="promotionDiv">
                            <span class="promotionPriceDesc">促销价 </span>
                            <span class="promotionPriceYuan">¥</span>
                            <span class="promotionPrice">
						${p.price}
					</span>
                        </div>
                    </div>
                </div>
                <div class="productSaleAndReviewNumber">
                    <div>销量 <span class="redColor boldWord"> 50</span></div>
                    <div>累计评价 <span class="redColor boldWord"> 19</span></div>
                </div>
                <div class="productNumber">
                    <span>数量</span>
                    <span>
				<span class="productNumberSettingSpan">
				<input class="productNumberSetting" type="text" value="1" id="count">
				</span>
				<span class="arrow">
					<a href="#nowhere" class="increaseNumber">
					<span class="updown">
							<img src="img/site/increase.png">
					</span>
					</a>

					<span class="updownMiddle"> </span>
					<a href="#nowhere"  class="decreaseNumber">
					<span class="updown">
							<img src="img/site/decrease.png">
					</span>
					</a>

				</span>

			件</span>
                    <span>库存66件</span>
                </div>
                <div class="serviceCommitment">
                    <span class="serviceCommitmentDesc">服务承诺</span>
                    <span class="serviceCommitmentLink">
				<a href="#nowhere">正品保证</a>
				<a href="#nowhere">极速退款</a>
				<a href="#nowhere">赠运费险</a>
				<a href="#nowhere">七天无理由退换</a>
			</span>
                </div>

                <div class="buyDiv">
                    <a class="buyLink" href="#nowhere"><button class="buyButton">立即购买</button></a>
                    <a href="javascript:addCart();" class="addCartLink"><button class="addCartButton" onclick="addCart2()" ><span class="glyphicon glyphicon-shopping-cart"></span>加入购物车</button></a>
                </div>
            </div>

            <div style="clear:both"></div>

        </div>

        <div class="productReviewDiv" >
            <div class="productReviewTopPart">
                <a  href="#nowhere" class="productReviewTopPartSelectedLink">商品详情</a>
                <a  href="#nowhere" class="selected">累计评价 <span class="productReviewTopReviewLinkNumber">19</span> </a>
            </div>

            <div class="productReviewContentPart">

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            不错的购物，包装很精细，布料也不错舒服，因为之前一直购买品牌装，很好的一次网购，生完宝宝刚刚一个多月我一百五十斤穿2XL不错
                        </div>
                        <div class="productReviewItemDate">2016-08-10</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        哀****莉<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            面料很好，大小也刚刚好，本来买之前还担心，犹豫，等货到了，比我心中想象的好很多，大家放心购买，很满意的购物，以后还会来??
                        </div>
                        <div class="productReviewItemDate">2016-08-23</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        贤*闲<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            <span>商品：</span>宝贝料子和手感都不错，是值这价，卖家很贴心的送了内衣带，5分好评是必须的。喜欢的可以 下手了
                        </div>
                        <div class="productReviewItemDate">2016-08-16</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        孤*****爱<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            衣服收到了，给朋友买的，真心不错，料子也特别好，穿起来特别有气质，跟模特穿的效果差不多。。。好评，好评
                        </div>
                        <div class="productReviewItemDate">2016-08-19</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        哀****莉<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            衣服不错，手感不错，试穿很有型，真心的喜欢，谢谢老板
                        </div>
                        <div class="productReviewItemDate">2016-07-19</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        孤*****爱<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            喜欢(⊙o⊙)哦，美美哒，值得一试！！！宽松雪纺，很舒服
                        </div>
                        <div class="productReviewItemDate">2016-08-10</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        这****0<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            衣服已经收到，大小很合适，面料也可以，就是感觉衣服面料有一点厚，其他都还不错，款式也好看，希望店家多出一点新款，以后回来光顾你们。?
                        </div>
                        <div class="productReviewItemDate">2016-07-10</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        y****心<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            很漂亮的衣服，料子有垂感，我很满意，老公也说好呢
                        </div>
                        <div class="productReviewItemDate">2016-07-27</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        阿*丶<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            真不错，已经迫不及待的穿上了，朋友们都说好，挺有气质的，就是上衣稍微有点肥，不过肉肉被藏起来了！有看上的赶紧下单吧！
                        </div>
                        <div class="productReviewItemDate">2016-08-12</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        名*****_<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            质量是真的不错，适合个子高一点的美眉穿，很漂亮?
                        </div>
                        <div class="productReviewItemDate">2016-08-03</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        安**°<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            再买的时候纠结了好久，最后还是选择在这里购买，一次满意的网购，让我对网购有了希望，或刚收到，因觉得物超所值，就迫不及待拍了照片，那个玻璃的声音非常脆，我个人觉得挺好的，值得拥有！
                        </div>
                        <div class="productReviewItemDate">2016-08-08</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        这****0<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            <span>服务：</span>不错
                        </div>
                        <div class="productReviewItemDate">2016-08-20</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        醉**心<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            强烈推荐，我的天，质量也太好了，让我情何以堪，大爱啊。说说我的体格吧，162.105斤，腰围大概是22，穿m码刚刚好。快递那么快，特地跟店家说10号要外出店家也尽心备注的很好。真的特别感动，我收藏店铺了，下次还来你们家。衣服比雪纺舒服，薄薄的，现在穿刚好，我配了高跟鞋和小白鞋都很完美。店家还送了无痕肩带，真的太细心了，给一百个好评，赞。衣服我看了没有线头，薄薄的。不说了，我赶紧发给我姐让她看看。
                        </div>
                        <div class="productReviewItemDate">2016-08-17</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        安**°<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            此用户没有填写评论！
                        </div>
                        <div class="productReviewItemDate">2016-07-21</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        乱**型<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            衣服质量真心不错很厚实，上身效果很棒哦，穿起来很舒服，很洋气。价格也很合理……赞赞赞
                        </div>
                        <div class="productReviewItemDate">2016-08-19</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        丶***眠<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            衣服裤子都很合身，同事笑我说这是我买得最好看最时尚的一套衣服，衣服上身效果也不错，很是满意，还送了隐形带，正好用上，质量很好穿着凉快，唯一不足的就是洗了后需要烫一下才不皱，不过不影响衣服的美，很满意。上传两张没P的照片
                        </div>
                        <div class="productReviewItemDate">2016-08-08</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        乱**型<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            不好意思好久才来评价  质量好  上身效果好  主要有胖子穿的漂亮衣服啦   赞赞赞
                        </div>
                        <div class="productReviewItemDate">2016-07-11</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        l******1<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            网购以来为数不多的质量好到超乎意料，穿上特别舒服，大小也正合适，超赞！这个店里值得好好逛逛！
                        </div>
                        <div class="productReviewItemDate">2016-07-10</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        盗**记<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

                <div class="productReviewItem">

                    <div class="productReviewItemDesc">
                        <div class="productReviewItemContent">
                            宝贝面料很舒服，一字领也非常美，说实话是充上衣买的！犹豫了很长时间才下定决心的，很喜欢，很满意！喜欢就是最值的！
                        </div>
                        <div class="productReviewItemDate">2016-07-24</div>
                    </div>
                    <div class="productReviewItemUserInfo">

                        贤*闲<span class="userInfoGrayPart">（匿名）</span>
                    </div>

                    <div style="clear:both"></div>

                </div>

            </div>

        </div>

        <div class="productDetailDiv" >
            <div class="productDetailTopPart">
                <a href="#nowhere" class="productDetailTopPartSelectedLink selected">商品详情</a>
                <a href="#nowhere" class="productDetailTopReviewLink">累计评价 <span class="productDetailTopReviewLinkNumber">19</span> </a>
            </div>

            <div class="productParamterPart">
                <div class="productParamter">产品参数：</div>

                <div class="productParamterList">

                    <span>材质成分:  聚酯纤维100% </span>

                    <span>品牌:  Emyche/艾米秋 </span>

                    <span>货号:  129668 </span>

                    <span>尺码:  L M S XL X </span>

                    <span>上市年份季节:  2016年夏季 </span>

                    <span>颜色分类:  白色 黑色 浅蓝 </span>

                    <span>适用年龄:  18-25周岁 </span>

                </div>
                <div style="clear:both"></div>
            </div>

            <div class="productDetailImagesPart">

                ${p.intro}

            </div>
        </div>

    </div>
</div>
<script>

    function addCart()
    {
        console.log("addCart()");
        // 1. 商品编号
        var pid = ${p.id};
        // 2. 商品数量
        var count = $("#count").val();

        console.log(pid+","+count);
    }

    function addCart2()
    {
        console.log("addCart2()");
        // 1. 商品编号
        var pid = ${p.id};
        // 2. 商品数量
        var count = $("#count").val();

        console.log(pid+","+count);

        // 跳转
        window.location = "/addcart?id="+pid+"&count="+count;
    }
</script>

<%@include file="footer.jsp"%>
</body>
</html>